#include <iostream>
using namespace std;
int main()
{
long long n,ans=0,k=1;
cin>>n;
do
{
ans+=2;
n-=k;
k+=10*ans;	
}while(k<=n);
cout <<ans;
return 0;	
}
//输入100 输出6
